<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Rep\IndexRep;
use Illuminate\Http\Request;
use Cisco\Aliyunsms\Facades\Aliyunsms;

class Index extends Controller
{
    //首页
    protected $rep;

    public function __construct(Request $request)
    {
        $this->rep = new IndexRep();
    }


    /**
     * 首页头部数据
     * @return \Illuminate\Http\JsonResponse
     */
    public function getIndexHeaderData(Request $request){
        $params = $request->all();
        $data = $this->rep->getIndexHeaderDataRep($params);
        return re(0,$data,'success');
    }

    /**
     * 获取近30天订单量
     */
    public function getThirtyDayOrderNumber(){
        $data = $this->rep->getThirtyDayOrderNumberRep();
        return re($data['code'],$data['data'],$data['msg']);
    }

    /**
     * 年度下单TOP10客户
     */
    public function getTOP10Customer(){
        $data = $this->rep->getTOP10CustomerRep();
        return re($data['code'],$data['data'],$data['msg']);
    }


    /**
     * 获取年度个产品的订单量
     */
    public function getAnnualProductOrderNumber(){
        $data = $this->rep->getAnnualProductOrderNumberRep();
        return re($data['code'],$data['data'],$data['msg']);
    }

    /**
     * 近6个月订单量
     */
    public function getNearlySexMonthsOrderNumber(){
        $data = $this->rep->getNearlySexMonthsOrderNumberRep();
        return re($data['code'],$data['data'],$data['msg']);
    }

    /**
     * 材料统计分析表
     * @return void
     */
    public function getMaterialStatisticAnalysis(){
        $data = $this->rep->getMaterialStatisticAnalysisRep();
        return re(0,$data,'success');
    }








}
